package com.example.demo.controller.ro;

import com.alibaba.fastjson.annotation.JSONField;
import com.example.demo.filter.BigDecimalSerialize;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.util.List;

/**
 * @author huangke
 * @description
 * @date 2021/1/12
 */
@Data
public class InsertRo {

    @JSONField(serializeUsing = BigDecimalSerialize.class)
//    @JsonSerialize(nullsUsing = BigDecimalSerialize.class)
    private BigDecimal aa;
    @NotBlank(message = "name不能为空")
    private String name;
    @NotNull(message = "age不能为null")
    private Integer age;
    @NotEmpty(message = "address不能为空")
    private List<String> address;
    @Pattern(regexp = "[0]|[1]|[2]", message = "stage请传1或2")
    private String stage;

    private Boolean flag;
    @NotEmpty(message = "mobile不能为空")
    @Valid
    @Size(min = 1, max = 3, message = "0 < mobiles <= 3")
    private List<Mobile> mobiles;

    @Data
    public static class Mobile {
        @NotBlank(message = "num不能为空")
        private String num;
    }
}